package com.deanlib.cabinet.ui;

import android.app.Activity;
import android.content.Intent;

import com.deanlib.cabinet.data.model.Resource;
import com.deanlib.cabinet.ui.view.LoginActivity;
import com.deanlib.cabinet.ui.view.MediaGalleryBrowser;
import com.deanlib.cabinet.ui.view.RegisterActivity;
import com.deanlib.cabinet.ui.view.MainActivity;
import com.deanlib.cabinet.ui.view.SettingsActivity;
import com.deanlib.cabinet.ui.view.UserActivity;
import com.deanlib.cabinet.utils.JsonUtils;

/**
 * Created by Dean on 2022/6/13
 */
public class Navigation {

    public static final int CODE_LOGIN = 200001;

    public static void toLogin(Activity activity){
        Intent intent = new Intent(activity, LoginActivity.class);
        activity.startActivityForResult(intent,CODE_LOGIN);
    }

    public static void toRegister(Activity activity){
        Intent intent = new Intent(activity, RegisterActivity.class);
        activity.startActivity(intent);
    }

    public static void toMain(Activity activity){
        Intent intent = new Intent(activity, MainActivity.class);
        activity.startActivity(intent);
    }

    public static void toUser(Activity activity){
        Intent intent = new Intent(activity, UserActivity.class);
        activity.startActivity(intent);
    }

    public static void toSettings(Activity activity){
        Intent intent = new Intent(activity, SettingsActivity.class);
        activity.startActivity(intent);
    }

    public static void toMediaGalleryBrowser(Activity activity, Resource resource){
        Intent intent = new Intent(activity, MediaGalleryBrowser.class);
        intent.putExtra("resource", JsonUtils.getGson().toJson(resource));
        activity.startActivity(intent);
    }
}
